package com.cedric.yixianpai.game.cards.Sects.swordCards.c_JinDan;

import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class FanShenJian extends SwordCard {
    private int nextShield = 0;

    /**
     * title:反身剑
     * effect:-1SE 11/14/17 击伤:下回合加7/10/13防
     */
    public FanShenJian(@Value("1") int lvl) {
        super("反身剑");
        this.setLevel(lvl);
        this.setPeriod(Period.JINDAN);
        this.setDescription("灵气-1 11/14/17 击伤:下回合加7/10/13防");
        this.setSpiritNeed(1);
        if (1 == lvl) {
            this.setDamage(11);
            this.nextShield = 7;
        } else if (2 == lvl) {
            this.setDamage(14);
            this.nextShield = 10;
        } else if (3 == lvl) {
            this.setDamage(17);
            this.nextShield = 13;
        } else {
            throw new RuntimeException("Card Level Error!");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        if (Sta1.spiritEnough(this.getSpiritNeed())) {
            if (Sta1.attack(Sta2, this.getDamage()) > 0) {
                Sta1.getPlayerBuff().addNextShield(this.nextShield);
            }
            Sta1.getPlayerBuff().clearSwordIntent();
            return true;
        }
        return false;
    }
}
